
"""
    pycoopiler - a compiler developed to PCS2056 course (Compilers) at Poli-USP
    Copyright (C) 2008 Andre Felipe Santos    
    Copyright (C) 2008 Rodrigo Rodrigues da Silva

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
"""
from pycoopiler.enum import enum

class token:
    "this class represents a token to be recognized by the lex_analyzer"
    
    types = enum("INF NOME NUM OP_AND OP_OR OP_NOT ABRE_P FECHA_P VINCULO META VIRGULA EOF")    
    
    def __init__(self, info, type):
        self.info = info
        if type in dir(self.types):
            self.type = type
        else:
            raise Exception ("Invalid type!")
        
    def __repr__(self):
        return '<' + self.type.__str__() +'|' + self.info + '>'
    
    def __str__(self):
        return self.__repr__()
        
    

